package so.sao.code.service.config;

import java.util.Arrays;

import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 缓存配置类
 */
@Configuration
@EnableCaching
public class CacheConfig{	
	
	/**
	 * 缓存管理器.
	 * 
	 * @param redisTemplate
	 * @return
	 */
	//TODO redis 或本地缓存，待做。。。。。。
    @Bean
    public CacheManager cacheManager() {
        // configure and return an implementation of Spring's CacheManager SPI
        SimpleCacheManager cacheManager = new SimpleCacheManager();
        cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache("codeSupplierConfigs")));
        return cacheManager;
    }

}
